<template>
  <div>
      <h1>注册界面</h1>
      <p>用户名：<input type="text" v-model="username"></p>
      <p>密  码：<input type="text" v-model="password1"></p>
      <p>确认密码：<input type="text" v-model="password2"></p>
      <!-- <button @click="sub">注册</button> -->
      <el-button type="primary">注册</el-button>
  </div>
</template>

<script>
import axios from 'axios';
export default {
     data(){
        return {
            username:'',
            password1:'',
            password2:'',
            base_url:'http://127.0.0.1:8000'
        }
    },
    methods:{
        sub(){
            console.log(this.username,this.password1,this.password2)
            let form_data = new FormData()
            form_data.append('username',this.username)
            form_data.append('password1',this.password1)
            form_data.append('password2',this.password2)
            axios({
                url: this.base_url + '/app01/user',
                method:'post',
                data:form_data
            }).then(res =>{
                console.log(res.data)
                this.$router.push({
                    name:'Login'
                })
            })
        }
    }
}
</script>

<style>

</style>